package com.project.service;
import com.project.entity.Completion;
import com.project.dao.CompletionMapper;
import com.project.service.CompletionService;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by root on 4/12/2018.
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class CompletionServiceImpl extends BaseService implements CompletionService{
    @Autowired
    CompletionMapper completionMapper;

    @Override
    public void add(Completion completion){
        completionMapper.insertSelective(completion);
    }

    @Override
    public Completion findByExerciseInfoId(Integer exerciseinfoid) {
        return completionMapper.selectByExerciseInfoId(exerciseinfoid);
    }

    @Override
    public int modify(Completion completion){return completionMapper.updateByPrimaryKeySelective(completion);}
}
